/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: yang
 * Date: 2022-09-05
 * Time: 17:27
 */
//public class Test {
//    public static void main(String[] args) throws InterruptedException {
////        class MyRunnable implements Runnable{
////            @Override
////            public void run() {
////                for (int i = 0; i < 10; i++) {
////                    System.out.println(1);
////                }
////            }
////        }
////
////        Thread t = new Thread(new MyRunnable());
//
////        Thread t = new Thread(){
////            @Override
////            public void run() {
////                for (int i = 0; i < 10; i++) {
////                    System.out.println(1);
////                }
////            }
////        };
//
////        class MyThread extends Thread{
////            @Override
////            public void run() {
////                for (int i = 0; i < 10; i++) {
////                    System.out.println(1);
////                }
////            }
////        }
////
////        MyThread t = new MyThread();
//
//
//        Thread t = new Thread(() -> {
//           while(isQuit){
//
//        });
//        t.start();
//        t.join();
//        System.out.println(2);
//
//        }
//    }

    public class Test {
        public static void main(String[] args) throws InterruptedException {
            Thread t = new Thread(() -> {
                for (int i = 0; i < 4; i++) {
                   System.out.println("hello thread");
                   try {
                       Thread.sleep(1000);
                   } catch (InterruptedException e) {
                       e.printStackTrace();
                   }
               }
            });
            System.out.println("线程开始");
            t.start();
            t.join();
            System.out.println("线程结束");
        }
    }



